﻿using System.Configuration;

namespace EP.Base.BaseService.Manager.Config
{
    public class ServiceMonitorConfigSection : ConfigurationSection
    {
        public static string SectionName
        {
            get { return "ServiceMonitorConfig"; }
        }
        /// <summary>
        /// 服务监控间隔 秒
        /// </summary>
        [ConfigurationProperty("MonitorInterval", IsRequired = false)]
        public int MonitorInterval
        {
            get { return (int)this["MonitorInterval"]; }
            set { this["MonitorInterval"] = value; }
        }
        /// <summary>
        /// 当前服务编号
        /// </summary>
        [ConfigurationProperty("CurrentServiceNum", IsRequired = false)]
        public int CurrentServiceNum
        {
            get { return (int)this["CurrentServiceNum"]; }
            set { this["CurrentServiceNum"] = value; }
        }
        

        /// <summary>
        /// redis地址
        /// </summary>
        [ConfigurationProperty("ServiceMonitorRedisConnectionString", IsRequired = false)]
        public string ServiceMonitorRedisConnectionString
        {
            get { return (string)this["ServiceMonitorRedisConnectionString"]; }
            set { this["ServiceMonitorRedisConnectionString"] = value; }
        }
        
        /// <summary>
        /// redis空间
        /// </summary>
        [ConfigurationProperty("KeySpace", IsRequired = false)]
        public string KeySpace
        {
            get { return (string)this["KeySpace"]; }
            set { this["KeySpace"] = value; }
        }

        /// <summary>
        /// 当前运行的服务存储key
        /// </summary>
        [ConfigurationProperty("ServiceMonitorCurrentNameRedisKey", IsRequired = false)]
        public string ServiceMonitorCurrentNameRedisKey
        {
            get { return (string)this["ServiceMonitorCurrentNameRedisKey"]; }
            set { this["ServiceMonitorCurrentNameRedisKey"] = value; }
        }
        /// <summary>
        /// 当前所有服务的列表存储key
        /// </summary>
        [ConfigurationProperty("ServiceMonitorServiceListRedisKey", IsRequired = false)]
        public string ServiceMonitorServiceListRedisKey
        {
            get { return (string)this["ServiceMonitorServiceListRedisKey"]; }
            set { this["ServiceMonitorServiceListRedisKey"] = value; }
        }
        /// <summary>
        /// 用于热切换主运行服务的服务存储key
        /// </summary>
        [ConfigurationProperty("ServiceMonitorReplaceNameRedisKey", IsRequired = false)]
        public string ServiceMonitorReplaceNameRedisKey
        {
            get { return (string)this["ServiceMonitorReplaceNameRedisKey"]; }
            set { this["ServiceMonitorReplaceNameRedisKey"] = value; }
        }
        /// <summary>
        /// 服务名称
        /// </summary>
        [ConfigurationProperty("ServiceName", IsRequired = false)]
        public string ServiceName
        {
            get { return (string)this["ServiceName"]; }
            set { this["ServiceName"] = value; }
        }
        /// <summary>
        /// 状态判断容差 秒
        /// </summary>
        [ConfigurationProperty("ToleranceSeconds", IsRequired = false)]
        public int ToleranceSeconds
        {
            get { return (int)this["ToleranceSeconds"]; }
            set { this["ToleranceSeconds"] = value; }
        }
    }
}
